home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / vbmbox / msgbox.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-02-09  |  30.5 KB  |  802 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Visual Basic Message Box"
  5.    ClientHeight    =   5040
  6.    ClientLeft      =   2085
  7.    ClientTop       =   2040
  8.    ClientWidth     =   7965
  9.    Height          =   5415
  10.    Icon            =   MSGBOX.FRX:0000
  11.    KeyPreview      =   -1  'True
  12.    Left            =   2040
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    ScaleHeight     =   5040
  16.    ScaleWidth      =   7965
  17.    Top             =   1710
  18.    Width           =   8055
  19.    Begin SSPanel sfxFormFX 
  20.       Alignment       =   0  'Left Justify - TOP
  21.       BackColor       =   &H00C0C0C0&
  22.       BevelInner      =   2  'Raised
  23.       BorderWidth     =   1
  24.       Font3D          =   0  'None
  25.       Height          =   5040
  26.       Left            =   45
  27.       RoundedCorners  =   0   'False
  28.       TabIndex        =   6
  29.       Top             =   30
  30.       Width           =   7920
  31.       Begin SSPanel p3dCmdButtons 
  32.          BackColor       =   &H00C0C0C0&
  33.          BevelInner      =   1  'Inset
  34.          BorderWidth     =   1
  35.          Font3D          =   0  'None
  36.          ForeColor       =   &H00FFFFFF&
  37.          Height          =   1230
  38.          Left            =   4575
  39.          TabIndex        =   25
  40.          Top             =   3630
  41.          Width           =   3210
  42.          Begin SSCommand c3dActions 
  43.             Caption         =   "Exit"
  44.             Font3D          =   3  'Inset w/light shading
  45.             ForeColor       =   &H00000080&
  46.             Height          =   525
  47.             Index           =   3
  48.             Left            =   1620
  49.             TabIndex        =   29
  50.             TabStop         =   0   'False
  51.             Top             =   630
  52.             Width           =   1500
  53.          End
  54.          Begin SSCommand c3dActions 
  55.             Caption         =   "&View MsgBox"
  56.             Font3D          =   3  'Inset w/light shading
  57.             ForeColor       =   &H00000000&
  58.             Height          =   525
  59.             Index           =   2
  60.             Left            =   75
  61.             TabIndex        =   28
  62.             TabStop         =   0   'False
  63.             Top             =   630
  64.             Width           =   1500
  65.          End
  66.          Begin SSCommand c3dActions 
  67.             Caption         =   "> Clip&board"
  68.             Font3D          =   3  'Inset w/light shading
  69.             ForeColor       =   &H00000000&
  70.             Height          =   525
  71.             Index           =   1
  72.             Left            =   1620
  73.             TabIndex        =   27
  74.             TabStop         =   0   'False
  75.             Top             =   75
  76.             Width           =   1500
  77.          End
  78.          Begin SSCommand c3dActions 
  79.             Caption         =   "> Code &Window"
  80.             Font3D          =   3  'Inset w/light shading
  81.             ForeColor       =   &H00000000&
  82.             Height          =   525
  83.             Index           =   0
  84.             Left            =   75
  85.             TabIndex        =   26
  86.             TabStop         =   0   'False
  87.             Top             =   75
  88.             Width           =   1500
  89.          End
  90.       End
  91.       Begin SSFrame f3dModalarity 
  92.          Caption         =   "Modalarity"
  93.          Font3D          =   3  'Inset w/light shading
  94.          ForeColor       =   &H00000000&
  95.          Height          =   1320
  96.          Left            =   2460
  97.          TabIndex        =   23
  98.          Top             =   3540
  99.          Width           =   2040
  100.          Begin SSOption o3dModality 
  101.             Caption         =   "System Moda&l"
  102.             Font3D          =   0  'None
  103.             Height          =   285
  104.             Index           =   1
  105.             Left            =   180
  106.             TabIndex        =   24
  107.             TabStop         =   0   'False
  108.             Top             =   795
  109.             Width           =   1700
  110.          End
  111.          Begin SSOption o3dModality 
  112.             Caption         =   "Appli&cation Modal"
  113.             Font3D          =   0  'None
  114.             Height          =   240
  115.             Index           =   0
  116.             Left            =   180
  117.             TabIndex        =   5
  118.             Top             =   375
  119.             Value           =   -1  'True
  120.             Width           =   1800
  121.          End
  122.       End
  123.       Begin SSFrame f3dDefaultButton 
  124.          Caption         =   "Default Button"
  125.          Font3D          =   3  'Inset w/light shading
  126.          ForeColor       =   &H00000000&
  127.          Height          =   1200
  128.          Left            =   90
  129.          TabIndex        =   15
  130.          Top             =   3660
  131.          Width           =   2250
  132.          Begin SSOption o3dDefaultButton 
  133.             Caption         =   "&3rd -"
  134.             Font3D          =   0  'None
  135.             Height          =   240
  136.             Index           =   2
  137.             Left            =   195
  138.             TabIndex        =   17
  139.             TabStop         =   0   'False
  140.             Top             =   850
  141.             Width           =   1980
  142.          End
  143.          Begin SSOption o3dDefaultButton 
  144.             Caption         =   "&2nd -"
  145.             Font3D          =   0  'None
  146.             Height          =   240
  147.             Index           =   1
  148.             Left            =   195
  149.             TabIndex        =   16
  150.             TabStop         =   0   'False
  151.             Top             =   550
  152.             Width           =   1980
  153.          End
  154.          Begin SSOption o3dDefaultButton 
  155.             Caption         =   "&1st -"
  156.             Font3D          =   0  'None
  157.             Height          =   240
  158.             Index           =   0
  159.             Left            =   195
  160.             TabIndex        =   4
  161.             Top             =   285
  162.             Value           =   -1  'True
  163.             Width           =   1980
  164.          End
  165.       End
  166.       Begin SSFrame f3dIcon 
  167.          Caption         =   "Icon"
  168.          Font3D          =   3  'Inset w/light shading
  169.          ForeColor       =   &H00000000&
  170.          Height          =   1140
  171.          Left            =   2445
  172.          TabIndex        =   22
  173.          Top             =   2295
  174.          Width           =   5355
  175.          Begin SSRibbon gpbIcon 
  176.             BackColor       =   &H00C0C0C0&
  177.             GroupAllowAllUp =   0   'False
  178.             Height          =   570
  179.             Index           =   4
  180.             Left            =   4560
  181.             PictureDisabled =   MSGBOX.FRX:0302
  182.             PictureDnChange =   0  'Use 'PictureUp' Bitmap Unchanged
  183.             PictureUp       =   MSGBOX.FRX:0B3C
  184.             Top             =   270
  185.             Value           =   -1  'True
  186.             Width           =   570
  187.          End
  188.          Begin SSRibbon gpbIcon 
  189.             BackColor       =   &H00C0C0C0&
  190.             GroupAllowAllUp =   0   'False
  191.             Height          =   570
  192.             Index           =   3
  193.             Left            =   3480
  194.             PictureDisabled =   MSGBOX.FRX:1376
  195.             PictureDnChange =   0  'Use 'PictureUp' Bitmap Unchanged
  196.             PictureUp       =   MSGBOX.FRX:1BB0
  197.             Top             =   270
  198.             Width           =   570
  199.          End
  200.          Begin SSRibbon gpbIcon 
  201.             BackColor       =   &H00C0C0C0&
  202.             GroupAllowAllUp =   0   'False
  203.             Height          =   570
  204.             Index           =   2
  205.             Left            =   2400
  206.             PictureDisabled =   MSGBOX.FRX:23EA
  207.             PictureDnChange =   0  'Use 'PictureUp' Bitmap Unchanged
  208.             PictureUp       =   MSGBOX.FRX:2C24
  209.             Top             =   270
  210.             Width           =   570
  211.          End
  212.          Begin SSRibbon gpbIcon 
  213.             BackColor       =   &H00C0C0C0&
  214.             GroupAllowAllUp =   0   'False
  215.             Height          =   570
  216.             Index           =   1
  217.             Left            =   1320
  218.             PictureDisabled =   MSGBOX.FRX:345E
  219.             PictureDnChange =   0  'Use 'PictureUp' Bitmap Unchanged
  220.             PictureUp       =   MSGBOX.FRX:3C98
  221.             Top             =   270
  222.             Width           =   570
  223.          End
  224.          Begin SSRibbon gpbIcon 
  225.             BackColor       =   &H00C0C0C0&
  226.             GroupAllowAllUp =   0   'False
  227.             Height          =   570
  228.             Index           =   0
  229.             Left            =   240
  230.             PictureDisabled =   MSGBOX.FRX:44D2
  231.             PictureDnChange =   0  'Use 'PictureUp' Bitmap Unchanged
  232.             PictureUp       =   MSGBOX.FRX:4D0C
  233.             Top             =   270
  234.             Width           =   570
  235.          End
  236.          Begin Label lblIcons 
  237.             AutoSize        =   -1  'True
  238.             Caption         =   "No Icon"
  239.             Height          =   195
  240.             Index           =   4
  241.             Left            =   4485
  242.             TabIndex        =   36
  243.             Top             =   870
  244.             Width           =   690
  245.          End
  246.          Begin Label lblIcons 
  247.             AutoSize        =   -1  'True
  248.             Caption         =   "I&nformation"
  249.             Height          =   195
  250.             Index           =   3
  251.             Left            =   3310
  252.             TabIndex        =   35
  253.             Top             =   870
  254.             Width           =   960
  255.          End
  256.          Begin Label lblIcons 
  257.             AutoSize        =   -1  'True
  258.             Caption         =   "E&xclamation"
  259.             Height          =   195
  260.             Index           =   2
  261.             Left            =   2190
  262.             TabIndex        =   34
  263.             Top             =   870
  264.             Width           =   1035
  265.          End
  266.          Begin Label lblIcons 
  267.             AutoSize        =   -1  'True
  268.             Caption         =   "&Question"
  269.             Height          =   195
  270.             Index           =   1
  271.             Left            =   1245
  272.             TabIndex        =   33
  273.             Top             =   870
  274.             Width           =   765
  275.          End
  276.          Begin Label lblIcons 
  277.             AutoSize        =   -1  'True
  278.             Caption         =   "S&top"
  279.             Height          =   195
  280.             Index           =   0
  281.             Left            =   310
  282.             TabIndex        =   32
  283.             Top             =   855
  284.             Width           =   405
  285.          End
  286.       End
  287.       Begin SSFrame f3dButtons 
  288.          Caption         =   "Buttons"
  289.          Font3D          =   3  'Inset w/light shading
  290.          ForeColor       =   &H00000000&
  291.          Height          =   1965
  292.          Left            =   90
  293.          TabIndex        =   9
  294.          Top             =   1600
  295.          Width           =   2250
  296.          Begin SSOption o3dButtons 
  297.             Caption         =   "&Retry/Cancel"
  298.             Font3D          =   0  'None
  299.             Height          =   240
  300.             Index           =   5
  301.             Left            =   210
  302.             TabIndex        =   14
  303.             TabStop         =   0   'False
  304.             Top             =   1640
  305.             Width           =   1950
  306.          End
  307.          Begin SSOption o3dButtons 
  308.             Caption         =   "Y&es/No"
  309.             Font3D          =   0  'None
  310.             Height          =   240
  311.             Index           =   4
  312.             Left            =   210
  313.             TabIndex        =   13
  314.             TabStop         =   0   'False
  315.             Top             =   1350
  316.             Width           =   1950
  317.          End
  318.          Begin SSOption o3dButtons 
  319.             Caption         =   "&Yes/No/Cancel"
  320.             Font3D          =   0  'None
  321.             Height          =   240
  322.             Index           =   3
  323.             Left            =   210
  324.             TabIndex        =   12
  325.             TabStop         =   0   'False
  326.             Top             =   1060
  327.             Width           =   1950
  328.          End
  329.          Begin SSOption o3dButtons 
  330.             Caption         =   "&Abort/Retry/Ignore"
  331.             Font3D          =   0  'None
  332.             Height          =   240
  333.             Index           =   2
  334.             Left            =   210
  335.             TabIndex        =   11
  336.             TabStop         =   0   'False
  337.             Top             =   775
  338.             Width           =   1950
  339.          End
  340.          Begin SSOption o3dButtons 
  341.             Caption         =   "O&K/Cancel"
  342.             Font3D          =   0  'None
  343.             Height          =   240
  344.             Index           =   1
  345.             Left            =   210
  346.             TabIndex        =   10
  347.             TabStop         =   0   'False
  348.             Top             =   500
  349.             Width           =   1950
  350.          End
  351.          Begin SSOption o3dButtons 
  352.             Caption         =   "&OK"
  353.             Font3D          =   0  'None
  354.             Height          =   240
  355.             Index           =   0
  356.             Left            =   210
  357.             TabIndex        =   3
  358.             Top             =   225
  359.             Value           =   -1  'True
  360.             Width           =   1950
  361.          End
  362.       End
  363.       Begin SSFrame f3dProcedure 
  364.          Caption         =   "Procedure Type"
  365.          Font3D          =   3  'Inset w/light shading
  366.          ForeColor       =   &H00000000&
  367.          Height          =   1485
  368.          Left            =   90
  369.          MousePointer    =   1  'Arrow
  370.          TabIndex        =   21
  371.          Tag             =   "Choose to use either MsbBox statement or MsgBox() function"
  372.          Top             =   60
  373.          Width           =   2250
  374.          Begin SSCheck x3dDimMsg 
  375.             Caption         =   "&Dim Msg$"
  376.             Font3D          =   0  'None
  377.             ForeColor       =   &H00000000&
  378.             Height          =   240
  379.             Left            =   450
  380.             TabIndex        =   37
  381.             TabStop         =   0   'False
  382.             Top             =   840
  383.             Value           =   -1  'True
  384.             Width           =   1665
  385.          End
  386.          Begin SSCheck x3dDimResponse 
  387.             Caption         =   "&Dim Response%"
  388.             Enabled         =   0   'False
  389.             Font3D          =   0  'None
  390.             ForeColor       =   &H00000000&
  391.             Height          =   240
  392.             Left            =   435
  393.             TabIndex        =   8
  394.             TabStop         =   0   'False
  395.             Top             =   1125
  396.             Width           =   1665
  397.          End
  398.          Begin SSOption o3dProcedureType 
  399.             Caption         =   "MsgBox() &Function"
  400.             Enabled         =   0   'False
  401.             Font3D          =   0  'None
  402.             Height          =   240
  403.             Index           =   1
  404.             Left            =   195
  405.             TabIndex        =   7
  406.             TabStop         =   0   'False
  407.             Top             =   570
  408.             Width           =   1890
  409.          End
  410.          Begin SSOption o3dProcedureType 
  411.             Caption         =   "MsgBox &Statement"
  412.             Font3D          =   0  'None
  413.             Height          =   240
  414.             Index           =   0
  415.             Left            =   200
  416.             TabIndex        =   2
  417.             Tag             =   "275"
  418.             Top             =   275
  419.             Value           =   -1  'True
  420.             Width           =   1890
  421.          End
  422.       End
  423.       Begin SSFrame f3dTextFields 
  424.          Caption         =   "Text Strings"
  425.          Font3D          =   3  'Inset w/light shading
  426.          ForeColor       =   &H00000000&
  427.          Height          =   2145
  428.          Left            =   2445
  429.          TabIndex        =   18
  430.          Top             =   60
  431.          Width           =   5325
  432.          Begin SSPanel Panel3D2 
  433.             BackColor       =   &H00C0C0C0&
  434.             BevelInner      =   1  'Inset
  435.             BevelOuter      =   0  'None
  436.             BorderWidth     =   1
  437.             Caption         =   "Panel3D2"
  438.             Font3D          =   0  'None
  439.             Height          =   300
  440.             Left            =   165
  441.             RoundedCorners  =   0   'False
  442.             TabIndex        =   20
  443.             Top             =   480
  444.             Width           =   5115
  445.             Begin TextBox txtTitleField 
  446.                BorderStyle     =   0  'None
  447.                Height          =   225
  448.                Left            =   60
  449.                TabIndex        =   0
  450.                Top             =   45
  451.                Width           =   5010
  452.             End
  453.          End
  454.          Begin SSPanel Panel3D1 
  455.             BackColor       =   &H00C0C0C0&
  456.             BevelInner      =   1  'Inset
  457.             BevelOuter      =   0  'None
  458.             BorderWidth     =   1
  459.             Caption         =   "Panel3D1"
  460.             Font3D          =   0  'None
  461.             Height          =   1005
  462.             Left            =   165
  463.             RoundedCorners  =   0   'False
  464.             TabIndex        =   19
  465.             Top             =   1080
  466.             Width           =   5115
  467.             Begin TextBox txtMsgField 
  468.                BorderStyle     =   0  'None
  469.                Height          =   930
  470.                Left            =   60
  471.                MultiLine       =   -1  'True
  472.                ScrollBars      =   2  'Vertical
  473.                TabIndex        =   1
  474.                Top             =   30
  475.                Width           =   5025
  476.             End
  477.          End
  478.          Begin Label lblMessage 
  479.             AutoSize        =   -1  'True
  480.             Caption         =   "&Message (Msg)"
  481.             Height          =   195
  482.             Left            =   180
  483.             TabIndex        =   31
  484.             Top             =   855
  485.             Width           =   1290
  486.          End
  487.          Begin Label lblTitle 
  488.             AutoSize        =   -1  'True
  489.             Caption         =   "T&itle"
  490.             Height          =   195
  491.             Left            =   165
  492.             TabIndex        =   30
  493.             Top             =   255
  494.             Width           =   390
  495.          End
  496.       End
  497.    End
  498. Option Explicit
  499. Dim MBV As MBValue    'User defined
  500. Dim iDefVal As Integer
  501. Dim iSaveDimResponse As Integer
  502. Dim iSelected_Buttons As Integer
  503. Dim CRLF As String
  504. Sub c3dActions_Click (Index As Integer)
  505. On Error GoTo ACTIONerr
  506. iDefVal = MBV.Buttons + MBV.ICON + MBV.MODAL + MBV.DefButton
  507. Dim Msg As String
  508. Dim sTempMsg As String
  509. Select Case Index
  510.   'paste to window/clipboard
  511.   Case 0, 1:
  512.           Dim sCBtext As String
  513.           Dim VBhWnd As Integer, FORMhWnd As Integer      'VB program & form hWnd
  514.           Dim iNumTextLines As Integer, iRet As Integer   'iNumTextLines = # of lines to mark after paste
  515.           Dim i As Integer, j As Integer
  516.           ClipBoard.Clear                                 'Clear Clipboard.
  517.           sCBtext = "'start_insert ---------------------" & CRLF
  518.           iNumTextLines = 1
  519.           If x3dDimMsg.Value Then
  520.             sCBtext = sCBtext & "Dim Msg As String" & CRLF
  521.             iNumTextLines = iNumTextLines + 1
  522.           End If
  523.           If x3dDimResponse.Value Then
  524.             sCBtext = sCBtext & "Dim Response As Integer" & CRLF
  525.             iNumTextLines = iNumTextLines + 1
  526.           End If
  527.           'If Main!Text2.Text > "" Then
  528.             j = 1
  529.             For i = 1 To SendMessage(txtMsgField.hWnd, EM_GETLINECOUNT, 0, 0)
  530.               sTempMsg = Mid$(txtMsgField, j, SendMessage(txtMsgField.hWnd, EM_LINELENGTH, j, 0))
  531.               j = j + SendMessage(txtMsgField.hWnd, EM_LINELENGTH, j, 0) + 2
  532.               If sTempMsg <> "" Then
  533.                 sCBtext = sCBtext & "Msg = Msg & " & Chr$(34) & sTempMsg & Chr$(34) & " & Chr$(13) & Chr$(10)" & CRLF
  534.               Else
  535.                 sCBtext = sCBtext & "Msg = Msg & Chr$(13) & Chr$(10)" & CRLF
  536.               End If
  537.               iNumTextLines = iNumTextLines + 1
  538.               sTempMsg = ""
  539.             Next
  540.       
  541.             If o3dProcedureType(1).Value Then     'Function
  542.         
  543.               sCBtext = sCBtext & "Response = MsgBox(Msg, " & CStr(iDefVal) & ", " & Chr$(34) & txtTitleField & Chr$(34) & ")" & CRLF
  544.               iNumTextLines = iNumTextLines + 1
  545.         
  546.               For i = 0 To 2            'process the selected 'default button' first
  547.                 If o3dDefaultButton(i).Value Then
  548.                   j = i
  549.                   sCBtext = sCBtext & "If Response = " & o3dDefaultButton(i).Tag & " then        '" & Mid$(o3dDefaultButton(i).Caption, 6, Len(o3dDefaultButton(i).Caption)) & CRLF
  550.                   iNumTextLines = iNumTextLines + 1
  551.                   Exit For
  552.                 End If
  553.               Next
  554.               For i = 0 To 2            '3 default button selections... process the remaining 2
  555.                 If i <> j Then
  556.                   If o3dDefaultButton(i).Visible Then
  557.                     sCBtext = sCBtext & "ElseIf Response = " & o3dDefaultButton(i).Tag & " then    '" & Mid$(o3dDefaultButton(i).Caption, 6, Len(o3dDefaultButton(i).Caption)) & CRLF
  558.                     iNumTextLines = iNumTextLines + 1
  559.                   End If
  560.                 End If
  561.               Next
  562.               sCBtext = sCBtext & "End If" & CRLF
  563.               iNumTextLines = iNumTextLines + 1
  564.               'Debug.Print sCBtext
  565.             Else                        'Statement
  566.               sCBtext = sCBtext & "MsgBox Msg, " & CStr(iDefVal) & ", " & Chr$(34) & txtTitleField & Chr$(34) & CRLF
  567.               iNumTextLines = iNumTextLines + 1
  568.             End If
  569.             sCBtext = sCBtext & "'end_insert -----------------------" & CRLF
  570.             iNumTextLines = iNumTextLines + 1
  571.             ClipBoard.SetText sCBtext, 1
  572. End Select
  573. Select Case Index
  574.   '-paste to window
  575.   Case 0: VBhWnd = FindWindow("wndclass_desked_gsk", 0&)
  576.           If VBhWnd = 0 Then
  577.           '  iRet = WinExec("C:\VB\VB", 0)
  578.           '  VBhWnd = FindWindow(TEXTWINDOW, 0&)
  579.           '  If VBhWnd = 0 Then
  580.               MsgBox "No open code windows to write to!" & CRLF & "Code has been copied to Clipboard!", MB_ICONINFORMATION, "COPIED"
  581.               'MsgBox "Unable to launch Visual Basic"
  582.               GoTo ACTIONend
  583.           '  End If
  584.           End If
  585.           'AppActivate "Microsoft Visual Basic [run]"      'use when in vb environment
  586.           'AppActivate "Microsoft Visual Basic [design]"   'use when compiling
  587.           AppActivate "Microsoft Visual Basic"             '**use when compiling**
  588.           FORMhWnd = FindWindow("OEBDebug", 0&)
  589.           If FORMhWnd = 0 Then
  590.             FORMhWnd = FindWindow("OModule", 0&)
  591.             If FORMhWnd = 0 Then
  592.               MsgBox "No open code windows to write to!" & CRLF & "Code has been copied to Clipboard!", MB_ICONINFORMATION, "COPIED"
  593.               GoTo ACTIONend
  594.             End If
  595.           End If
  596.           
  597.           ''wHandle = GetActiveWindow()
  598.           'Dim ClassLen As Integer, ClassName As String, MaxCount As Integer
  599.           'MaxCount = 128
  600.           'ClassName = String$(128, 0)
  601.           ''ClassLen = GetClassName(wHandle, ClassName, MaxCount)
  602.           'ClassLen = GetClassName(hWnd, ClassName, MaxCount)
  603.           'MsgBox Left$(ClassName, ClassLen) & " " & CStr(hWnd)
  604.           
  605.           iRet = SetFocusAPI(VBhWnd)        'give focus to VB
  606.           RestoreApp (VBhWnd)               'if VB minimized, restore
  607.           RestoreApp (FORMhWnd)             'if VB's form minimized, restore
  608.           
  609.           SendKeys "%EP", True              '{Alt E,P} keystrokes to paste back the new text
  610.           iRet = SetFocusAPI(FORMhWnd)      'give focus to the form
  611.           SendKeys "+{UP " & Format$(iNumTextLines) & "}", True  'mark pasted lines (from bottom up)
  612.           'WindowState = 1                  'minimize MsgBox.PROGRAM after window paste
  613.   '-paste to clipboard
  614.   Case 1: MsgBox "Code has been copied to Clipboard!", MB_ICONINFORMATION, "COPIED"
  615.   '-view msgbox
  616.   Case 2: MsgBox txtMsgField.Text, iDefVal, txtTitleField.Text
  617.   '-exit
  618.   Case 3: Unload Me
  619. End Select
  620. ACTIONend:
  621. Exit Sub
  622. ACTIONerr:
  623. ShowError
  624. Resume ACTIONend
  625. End Sub
  626. Sub Form_KeyUp (KeyCode As Integer, Shift As Integer)
  627. '-set focus on object, per label letter underscores
  628. Select Case Shift
  629.   Case 4        'alt
  630.     Select Case KeyCode
  631.       Case 73:      'i/I (title)
  632.                 txtTitleField.SetFocus
  633.       Case 77:      'm/M
  634.                 txtMsgField.SetFocus
  635.       Case 84:      't/T (stop)
  636.                 If gpbIcon(0).Enabled Then
  637.                   gpbIcon(0).Value = True
  638.                 End If
  639.       Case 81:      'q/Q (question)
  640.                 If gpbIcon(1).Enabled Then
  641.                   gpbIcon(1).Value = True
  642.                 End If
  643.       Case 88:      'x/X (exclamation)
  644.                 If gpbIcon(2).Enabled Then
  645.                   gpbIcon(2).Value = True
  646.                 End If
  647.       Case 78:      'n/N (information)
  648.                 If gpbIcon(3).Enabled Then
  649.                   gpbIcon(3).Value = True
  650.                 End If
  651.     End Select
  652. End Select
  653. End Sub
  654. Sub Form_Load ()
  655. CRLF = Chr$(13) & Chr$(10)
  656. iSaveDimResponse = False        'initial value
  657. Call o3dButtons_Click(0, True)  'initiate OK
  658. End Sub
  659. Sub Form_Unload (Cancel As Integer)
  660. Dim Response As Integer
  661. Response = MsgBox("Are you sure?", 36, "EXIT?")
  662. If Response = 6 Then  'YES
  663.   End
  664.   Const NoExit = 1
  665.   Cancel = NoExit
  666. End If
  667. End Sub
  668. Sub gpbIcon_Click (Index As Integer, Value As Integer)
  669. Select Case Index
  670.   Case 0: MBV.ICON = MB_ICONSTOP
  671.   Case 1: MBV.ICON = MB_ICONQUESTION
  672.   Case 2: MBV.ICON = MB_ICONEXCLAMATION
  673.   Case 3: MBV.ICON = MB_ICONINFORMATION
  674.   Case 4: MBV.ICON = 0
  675. End Select
  676. 'iDefVal = MBV.Buttons + MBV.ICON + MBV.MODAL + MBV.DefButton
  677. End Sub
  678. Sub o3dButtons_Click (Index As Integer, Value As Integer)
  679. iSelected_Buttons = Index
  680. Dim iJ As Integer
  681. Dim iNumButtons As Integer
  682. iNumButtons = 2                               'default
  683. o3dDefaultButton(1).Value = True              '2nd button on (default)
  684. Select Case Index
  685.   Case 0: MBV.Buttons = MB_OK
  686.           iNumButtons = 1
  687.           o3dDefaultButton(0).Value = True          '1st button on
  688.           o3dDefaultButton(0).Caption = "&1st--OK"
  689.           o3dDefaultButton(0).Tag = IDOK
  690.   Case 1: MBV.Buttons = MB_OKCANCEL
  691.           o3dDefaultButton(0).Caption = "&1st--OK"
  692.           o3dDefaultButton(0).Tag = IDOK
  693.           o3dDefaultButton(1).Caption = "&2nd--Cancel"
  694.           o3dDefaultButton(1).Tag = IDCANCEL
  695.   Case 2: MBV.Buttons = MB_ABORTRETRYIGNORE
  696.           iNumButtons = 3
  697.           o3dDefaultButton(0).Caption = "&1st--Abort"
  698.           o3dDefaultButton(0).Tag = IDABORT
  699.           o3dDefaultButton(1).Caption = "&2nd--Retry"
  700.           o3dDefaultButton(1).Tag = IDRETRY
  701.           o3dDefaultButton(2).Caption = "&3nd--Ignore"
  702.           o3dDefaultButton(2).Tag = IDIGNORE
  703.   Case 3: MBV.Buttons = MB_YESNOCANCEL
  704.           iNumButtons = 3
  705.           o3dDefaultButton(0).Caption = "&1st--Yes"
  706.           o3dDefaultButton(0).Tag = IDYES
  707.           o3dDefaultButton(1).Caption = "&2nd--No"
  708.           o3dDefaultButton(1).Tag = IDNO
  709.           o3dDefaultButton(2).Caption = "&3nd--Cancel"
  710.           o3dDefaultButton(2).Tag = IDCANCEL
  711.   Case 4: MBV.Buttons = MB_YESNO
  712.           o3dDefaultButton(0).Caption = "&1st--Yes"
  713.           o3dDefaultButton(0).Tag = IDYES
  714.           o3dDefaultButton(1).Caption = "&2nd--No"
  715.           o3dDefaultButton(1).Tag = IDNO
  716.   Case 5: MBV.Buttons = MB_RETRYCANCEL
  717.           o3dDefaultButton(0).Caption = "&1st--Retry"
  718.           o3dDefaultButton(0).Tag = IDRETRY
  719.           o3dDefaultButton(1).Caption = "&2nd--Cancel"
  720.           o3dDefaultButton(1).Tag = IDCANCEL
  721. End Select
  722. For iJ = 1 To 2
  723.   If iJ < iNumButtons Then                'all buttons below iNumButtons on
  724. '    o3dDefaultButton(iJ).Value = True
  725.     o3dDefaultButton(iJ).Visible = True
  726.   Else                                    'all buttons above iNumButtons off
  727.     o3dDefaultButton(iJ).Value = False
  728.     o3dDefaultButton(iJ).Visible = False
  729.   End If
  730. Select Case Index
  731.   Case 0:
  732.     'OK requires statement (only one button... no return value)
  733.     o3dProcedureType(0).Enabled = True    'MsgBox Statement on
  734.     o3dProcedureType(0).Value = True
  735.     o3dProcedureType(1).Value = False     'MsgBox Function off
  736.     o3dProcedureType(1).Enabled = False
  737.     iSaveDimResponse = x3dDimResponse.Value 'save user selection prior to turning off
  738.     x3dDimResponse.Value = False          'Dim Response off
  739.     x3dDimResponse.Enabled = False
  740.   Case Is > 0
  741.     'All others require function (multi-button... requiring return code)
  742.     o3dProcedureType(0).Enabled = False   'MsgBox Statement off
  743.     o3dProcedureType(0).Value = False
  744.     o3dProcedureType(1).Value = True      'MsgBox Function on
  745.     o3dProcedureType(1).Enabled = True
  746.     x3dDimResponse.Value = iSaveDimResponse 'Dim Response (value to previous state)
  747.     x3dDimResponse.Enabled = True         'Dim Response on
  748. End Select
  749. 'iDefVal = MBV.Buttons + MBV.ICON + MBV.MODAL + MBV.DefButton
  750. End Sub
  751. Sub o3dDefaultButton_Click (Index As Integer, Value As Integer)
  752. Select Case Index
  753.   Case 0: MBV.DefButton = MB_DEFBUTTON1
  754.   Case 1: MBV.DefButton = MB_DEFBUTTON2
  755.   Case 2: MBV.DefButton = MB_DEFBUTTON3
  756. End Select
  757. 'iDefVal = MBV.Buttons + MBV.ICON + MBV.MODAL + MBV.DefButton
  758. End Sub
  759. Sub o3dModality_Click (Index As Integer, Value As Integer)
  760. Dim iJ As Integer
  761. Select Case Index
  762.   Case 0: f3dIcon.Enabled = True    'APPLICATION MODAL
  763.           For iJ = 0 To 3
  764.             gpbIcon(iJ).Enabled = True
  765.             lblIcons(iJ).Enabled = True
  766.           Next
  767.           gpbIcon(4).Value = True 'Depress 'No Icon'
  768.           MBV.MODAL = MB_APPLMODAL
  769.   Case 1: f3dIcon.Enabled = False   'SYSTEM MODAL
  770.           For iJ = 0 To 3
  771.             gpbIcon(iJ).Value = True
  772.             gpbIcon(iJ).Enabled = False
  773.             lblIcons(iJ).Enabled = False
  774.           Next
  775.           gpbIcon(4).Value = True 'Depress 'No Icon'
  776.           MBV.MODAL = MB_SYSTEMMODAL
  777. End Select
  778. 'iDefVal = MBV.Buttons + MBV.ICON + MBV.MODAL + MBV.DefButton
  779. End Sub
  780. Sub RestoreApp (wHandle As Integer)
  781. Const WM_SYSCOMMAND = &H112
  782. Const SC_RESTORE = &HF120
  783. Dim t As Integer
  784. If IsIconic(wHandle) Then
  785.   t = PostMessage(wHandle, WM_SYSCOMMAND, SC_RESTORE, 0)
  786.   Call WaitSecs(1)
  787. End If
  788. End Sub
  789. Sub ShowError ()
  790. Dim Msg As String
  791. Msg = "The following Error occurred:" & CRLF & CRLF
  792. Msg = Msg & Error$ & CRLF & CRLF
  793. Msg = Msg & "Number: " & CStr(Err) & CRLF       'add the error number
  794. MsgBox Msg, , "E R R O R !"
  795. End Sub
  796. Sub WaitSecs (secs As Integer)
  797. Dim start As Single, Temp As Integer
  798. start = Timer
  799. While Timer < start + secs + 1
  800.   Temp = DoEvents()
  801. End Sub
  802.